<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="员工姓名" prop="employeeName">
        <el-input
          v-model="queryParams.employeeName"
          placeholder="请输入员工姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="客户企业" prop="companyName">
        <el-input
          v-model="queryParams.companyName"
          placeholder="请输入客户企业"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="签约主体" prop="signMainName">
        <el-input
          v-model="queryParams.signMainName"
          placeholder="请输入签约主体"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="月份" prop="month">
        <el-date-picker clearable
                        v-model="queryParams.month"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择月份">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select
          v-model="queryParams.status"
          placeholder="请选择状态"
          clearable
        >
          <el-option
            v-for="dict in cptiStatusOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="本期收入" prop="currentIncome">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.currentIncome"-->
      <!--          placeholder="请输入本期收入"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="本期免税收入" prop="currentTaxFreeIncome">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.currentTaxFreeIncome"-->
      <!--          placeholder="请输入本期免税收入"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="一次性补偿金收入" prop="onceCompensationIncome">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.onceCompensationIncome"-->
      <!--          placeholder="请输入一次性补偿金收入"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="全年一次性奖金额" prop="annualOnceBonusAmount">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.annualOnceBonusAmount"-->
      <!--          placeholder="请输入全年一次性奖金额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="年金领取收入额" prop="annuityReceiveIncome">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.annuityReceiveIncome"-->
      <!--          placeholder="请输入年金领取收入额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="已完税缴费额" prop="paidTaxPaymentAmount">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.paidTaxPaymentAmount"-->
      <!--          placeholder="请输入已完税缴费额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="全部缴费额" prop="fullPaymentAmount">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.fullPaymentAmount"-->
      <!--          placeholder="请输入全部缴费额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否一次性领取0否1是" prop="isOnceReceive">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.isOnceReceive"-->
      <!--          placeholder="请输入是否一次性领取0否1是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="领取方式" prop="receiveWay">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.receiveWay"-->
      <!--          placeholder="请输入领取方式"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="基本养老保险费" prop="basicEndowmentInsurance">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.basicEndowmentInsurance"-->
      <!--          placeholder="请输入基本养老保险费"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="基本医疗保险费" prop="basicMedicalInsurance">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.basicMedicalInsurance"-->
      <!--          placeholder="请输入基本医疗保险费"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="失业保险费" prop="accUnemploymentInsurance">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accUnemploymentInsurance"-->
      <!--          placeholder="请输入失业保险费"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="住房公积金" prop="accHouseAf">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accHouseAf"-->
      <!--          placeholder="请输入住房公积金"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计子女教育" prop="accChildrenEdu">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accChildrenEdu"-->
      <!--          placeholder="请输入累计子女教育"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计继续教育" prop="accContinueEdu">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accContinueEdu"-->
      <!--          placeholder="请输入累计继续教育"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计住房贷款利息" prop="accHouseLoanInterest">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accHouseLoanInterest"-->
      <!--          placeholder="请输入累计住房贷款利息"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计住房租金" prop="accHouseRent">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accHouseRent"-->
      <!--          placeholder="请输入累计住房租金"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计赡养老人" prop="accSupportElder">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accSupportElder"-->
      <!--          placeholder="请输入累计赡养老人"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计3岁以下婴幼儿照护" prop="accCareInfant">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accCareInfant"-->
      <!--          placeholder="请输入累计3岁以下婴幼儿照护"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="累计个人养老金" prop="accPersonPension">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.accPersonPension"-->
      <!--          placeholder="请输入累计个人养老金"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="企业" prop="enterpriseOccupationPension">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.enterpriseOccupationPension"-->
      <!--          placeholder="请输入企业"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="商业健康保险" prop="commercialHealthInsurance">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.commercialHealthInsurance"-->
      <!--          placeholder="请输入商业健康保险"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="税延养老保险" prop="taxDeferPensionInsurance">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.taxDeferPensionInsurance"-->
      <!--          placeholder="请输入税延养老保险"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="其他" prop="other">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.other"-->
      <!--          placeholder="请输入其他"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="允许扣除的税费" prop="allowDeductionTax">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.allowDeductionTax"-->
      <!--          placeholder="请输入允许扣除的税费"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="准予扣除的捐赠额" prop="allowDeductionDonation">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.allowDeductionDonation"-->
      <!--          placeholder="请输入准予扣除的捐赠额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="减免税额" prop="savingTax">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.savingTax"-->
      <!--          placeholder="请输入减免税额"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="个税" prop="personIncomeTax">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.personIncomeTax"-->
      <!--          placeholder="请输入个税"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="primary"-->
      <!--          plain-->
      <!--          icon="el-icon-plus"-->
      <!--          size="mini"-->
      <!--          @click="handleAdd"-->
      <!--          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:add']"-->
      <!--        >新增-->
      <!--        </el-button>-->
      <!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-success"
          size="mini"
          :disabled="multiple"
          @click="handleSubmit"
          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
        >批量提交
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-search"
          size="mini"
          :disabled="multiple"
          @click="handleAudit"
          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
        >批量审核
        </el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="danger"-->
      <!--          plain-->
      <!--          icon="el-icon-delete"-->
      <!--          size="mini"-->
      <!--          :disabled="multiple"-->
      <!--          @click="handleDelete"-->
      <!--          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:remove']"-->
      <!--        >删除-->
      <!--        </el-button>-->
      <!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="incomeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <!--      <el-table-column label="ID" align="center" prop="id" />-->
      <el-table-column label="员工编号" align="center" prop="employee.code"/>
      <el-table-column label="员工姓名" align="center" prop="employee.name"/>
      <el-table-column label="身份证号" align="center" prop="employee.cardNum"/>
      <el-table-column label="性别" align="center" prop="employee.sex">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.employee.sex"/>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="employee.age"/>
      <el-table-column label="客户企业" align="center" prop="company.nameSecond"/>
      <el-table-column label="签约主体" align="center" prop="signMain.name"/>
      <el-table-column label="月份" align="center" prop="month" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.month, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="本期收入" align="center" prop="currentIncome"/>-->
      <el-table-column label="本期免税收入" align="center" prop="currentTaxFreeIncome"/>
      <!--      <el-table-column label="一次性补偿金收入" align="center" prop="onceCompensationIncome" />-->
            <el-table-column label="全年一次性奖金额" align="center" prop="annualOnceBonusAmount" />
      <!--      <el-table-column label="年金领取收入额" align="center" prop="annuityReceiveIncome" />-->
      <!--      <el-table-column label="已完税缴费额" align="center" prop="paidTaxPaymentAmount" />-->
      <!--      <el-table-column label="全部缴费额" align="center" prop="fullPaymentAmount" />-->
      <!--      <el-table-column label="是否一次性领取" align="center" prop="isOnceReceive" />-->
      <!--      <el-table-column label="领取方式" align="center" prop="receiveWay" />-->
      <!--      <el-table-column label="领取原因" align="center" prop="receiveReason" />-->
      <!--      <el-table-column label="基本养老保险费" align="center" prop="basicEndowmentInsurance"/>-->
      <!--      <el-table-column label="基本医疗保险费" align="center" prop="basicMedicalInsurance"/>-->
      <!--      <el-table-column label="失业保险费" align="center" prop="accUnemploymentInsurance"/>-->
      <!--      <el-table-column label="住房公积金" align="center" prop="accHouseAf"/>-->
      <!--      <el-table-column label="累计子女教育" align="center" prop="accChildrenEdu"/>-->
      <!--      <el-table-column label="累计继续教育" align="center" prop="accContinueEdu"/>-->
      <!--      <el-table-column label="累计住房贷款利息" align="center" prop="accHouseLoanInterest"/>-->
      <!--      <el-table-column label="累计住房租金" align="center" prop="accHouseRent"/>-->
      <!--      <el-table-column label="累计赡养老人" align="center" prop="accSupportElder"/>-->
      <!--      <el-table-column label="累计3岁以下婴幼儿照护" align="center" prop="accCareInfant"/>-->
      <!--      <el-table-column label="累计个人养老金" align="center" prop="accPersonPension"/>-->
      <!--      <el-table-column label="企业(职业)年金" align="center" prop="enterpriseOccupationPension"/>-->
<!--      <el-table-column label="商业健康保险" align="center" prop="commercialHealthInsurance"/>-->
<!--      <el-table-column label="税延养老保险" align="center" prop="taxDeferPensionInsurance"/>-->
      <el-table-column label="其他" align="center" prop="other"/>
<!--      <el-table-column label="允许扣除的税费" align="center" prop="allowDeductionTax" />-->
      <el-table-column label="准予扣除的捐赠额" align="center" prop="allowDeductionDonation"/>
      <el-table-column label="减免税额" align="center" prop="savingTax"/>
      <el-table-column label="个税" align="center" prop="personIncomeTax"/>
      <!--      <el-table-column label="类型" align="center" prop="type" />-->
      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <span v-if="scope.row.status === '0'">待提交</span>
          <span v-if="scope.row.status === '1'">待审核</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            v-if="scope.row.status === '0'"
            icon="el-icon-success"
            @click="handleSubmit(scope.row)"
            v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
          >提交
          </el-button><el-button
          size="mini"
          type="text"
          icon="el-icon-search"
          v-if="scope.row.status === '1'"
          @click="handleAudit(scope.row)"
          v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:edit']"
        >审核
        </el-button>
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['comprehensivePersonTaxIncome:comprehensivePersonTaxIncome:remove']"-->
          <!--          >删除-->
          <!--          </el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改综合个税所得对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="125px">
        <!--        <el-form-item label="员工表id" prop="employeeId">-->
        <!--          <el-input v-model="form.employeeId" placeholder="请输入员工表id"/>-->
        <!--        </el-form-item>-->
        <el-row>
          <el-col :span="8">
            <el-form-item label="月份" prop="month">
              <el-date-picker clearable
                              style="width: 200px"
                              v-model="form.month"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择月份">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="本期收入" prop="currentIncome">
              <el-input v-model="form.currentIncome" style="width: 200px" placeholder="请输入本期收入"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="本期免税收入" prop="currentTaxFreeIncome">
              <el-input v-model="form.currentTaxFreeIncome" style="width: 200px" placeholder="请输入本期免税收入"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="一次性补偿金收入" prop="onceCompensationIncome">
              <el-input v-model="form.onceCompensationIncome" style="width: 200px" placeholder="请输入一次性补偿金收入"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="全年一次性奖金额" prop="annualOnceBonusAmount">
              <el-input v-model="form.annualOnceBonusAmount" style="width: 200px" placeholder="请输入全年一次性奖金额"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="年金领取收入额" prop="annuityReceiveIncome">
              <el-input v-model="form.annuityReceiveIncome" style="width: 200px" placeholder="请输入年金领取收入额"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="已完税缴费额" prop="paidTaxPaymentAmount">
              <el-input v-model="form.paidTaxPaymentAmount" style="width: 200px" placeholder="请输入已完税缴费额"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="全部缴费额" prop="fullPaymentAmount">
              <el-input v-model="form.fullPaymentAmount" style="width: 200px" placeholder="请输入全部缴费额"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="是否一次性领取" prop="isOnceReceive">
              <el-input v-model="form.isOnceReceive" style="width: 200px" placeholder="请输入是否一次性领取0否1是"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="领取方式" prop="receiveWay">
              <el-input v-model="form.receiveWay" style="width: 200px" placeholder="请输入领取方式"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="领取原因" prop="receiveReason">
              <el-input v-model="form.receiveReason" style="width: 200px" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="基本养老保险费" prop="basicEndowmentInsurance">
              <el-input v-model="form.basicEndowmentInsurance" style="width: 200px" placeholder="请输入基本养老保险费"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="基本医疗保险费" prop="basicMedicalInsurance">
              <el-input v-model="form.basicMedicalInsurance" style="width: 200px" placeholder="请输入基本医疗保险费"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="失业保险费" prop="accUnemploymentInsurance">
              <el-input v-model="form.accUnemploymentInsurance" style="width: 200px" placeholder="请输入失业保险费"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="住房公积金" prop="accHouseAf">
              <el-input v-model="form.accHouseAf" style="width: 200px" placeholder="请输入住房公积金"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="累计子女教育" prop="accChildrenEdu">
              <el-input v-model="form.accChildrenEdu" style="width: 200px" placeholder="请输入累计子女教育"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="累计继续教育" prop="accContinueEdu">
              <el-input v-model="form.accContinueEdu" style="width: 200px" placeholder="请输入累计继续教育"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="累计住房贷款利息" prop="accHouseLoanInterest">
              <el-input v-model="form.accHouseLoanInterest" style="width: 200px" placeholder="请输入累计住房贷款利息"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="累计住房租金" prop="accHouseRent">
              <el-input v-model="form.accHouseRent" style="width: 200px" placeholder="请输入累计住房租金"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="累计赡养老人" prop="accSupportElder">
              <el-input v-model="form.accSupportElder" style="width: 200px" placeholder="请输入累计赡养老人"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="累计3岁以下婴幼儿照护" prop="accCareInfant">
              <el-input v-model="form.accCareInfant" style="width: 200px" placeholder="请输入累计3岁以下婴幼儿照护"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="累计个人养老金" prop="accPersonPension">
              <el-input v-model="form.accPersonPension" style="width: 200px" placeholder="请输入累计个人养老金"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="企业(职业)年金" prop="enterpriseOccupationPension">
              <el-input v-model="form.enterpriseOccupationPension" style="width: 200px" placeholder="请输入企业"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="商业健康保险" prop="commercialHealthInsurance">
              <el-input v-model="form.commercialHealthInsurance" style="width: 200px" placeholder="请输入商业健康保险"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>

          <el-col :span="8">
            <el-form-item label="税延养老保险" prop="taxDeferPensionInsurance">
              <el-input v-model="form.taxDeferPensionInsurance" style="width: 200px" placeholder="请输入税延养老保险"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="其他" prop="other">
              <el-input v-model="form.other" style="width: 200px" placeholder="请输入其他"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="允许扣除的税费" prop="allowDeductionTax">
              <el-input v-model="form.allowDeductionTax" style="width: 200px" placeholder="请输入允许扣除的税费"/>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>

          <el-col :span="8">
            <el-form-item label="准予扣除的捐赠额" prop="allowDeductionDonation">
              <el-input v-model="form.allowDeductionDonation" style="width: 200px" placeholder="请输入准予扣除的捐赠额"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="减免税额" prop="savingTax">
              <el-input v-model="form.savingTax"  style="width: 200px" placeholder="请输入减免税额"/>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="个税" prop="personIncomeTax">
              <el-input v-model="form.personIncomeTax" style="width: 200px" placeholder="请输入个税"/>
            </el-form-item>
          </el-col>

        </el-row>

        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea"  style="width: 910px" placeholder="请输入内容"/>
        </el-form-item>


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  addComprehensivePersonTaxIncome,
  delComprehensivePersonTaxIncome,
  getComprehensivePersonTaxIncome,
  listComprehensivePersonTaxIncome,
  updateComprehensivePersonTaxIncome
} from "@/api/comprehensive_person_tax_income/comprehensivepersontaxincome";

export default {
  name: "annualOnceBonus",
  dicts: ['sys_user_sex'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 综合个税所得表格数据
      incomeList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        employeeId: null,
        month: null,
        currentIncome: null,
        currentTaxFreeIncome: null,
        onceCompensationIncome: null,
        annualOnceBonusAmount: null,
        annuityReceiveIncome: null,
        paidTaxPaymentAmount: null,
        fullPaymentAmount: null,
        isOnceReceive: null,
        receiveWay: null,
        receiveReason: null,
        basicEndowmentInsurance: null,
        basicMedicalInsurance: null,
        accUnemploymentInsurance: null,
        accHouseAf: null,
        accChildrenEdu: null,
        accContinueEdu: null,
        accHouseLoanInterest: null,
        accHouseRent: null,
        accSupportElder: null,
        accCareInfant: null,
        accPersonPension: null,
        enterpriseOccupationPension: null,
        commercialHealthInsurance: null,
        taxDeferPensionInsurance: null,
        other: null,
        allowDeductionTax: null,
        allowDeductionDonation: null,
        savingTax: null,
        personIncomeTax: null,
        type: null,
        status: null,
        employeeName: null,
        companyName: null,
        signMainName: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      cptiStatusOptions:[
        {label: '待提交', value: '0'},
        {label: '待审核', value: '1'},
        {label: '完成', value: '2'},
        {label: '失败', value: '3'},
      ],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询综合个税所得列表 */
    getList() {
      this.loading = true;
      this.queryParams.type = '3';
      listComprehensivePersonTaxIncome(this.queryParams).then(response => {
        this.incomeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        employeeId: null,
        month: null,
        currentIncome: null,
        currentTaxFreeIncome: null,
        onceCompensationIncome: null,
        annualOnceBonusAmount: null,
        annuityReceiveIncome: null,
        paidTaxPaymentAmount: null,
        fullPaymentAmount: null,
        isOnceReceive: null,
        receiveWay: null,
        receiveReason: null,
        basicEndowmentInsurance: null,
        basicMedicalInsurance: null,
        accUnemploymentInsurance: null,
        accHouseAf: null,
        accChildrenEdu: null,
        accContinueEdu: null,
        accHouseLoanInterest: null,
        accHouseRent: null,
        accSupportElder: null,
        accCareInfant: null,
        accPersonPension: null,
        enterpriseOccupationPension: null,
        commercialHealthInsurance: null,
        taxDeferPensionInsurance: null,
        other: null,
        allowDeductionTax: null,
        allowDeductionDonation: null,
        savingTax: null,
        personIncomeTax: null,
        type: null,
        status: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加综合个税所得";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getComprehensivePersonTaxIncome(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改综合个税所得";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateComprehensivePersonTaxIncome(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addComprehensivePersonTaxIncome(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除综合个税所得编号为"' + ids + '"的数据项？').then(function () {
        return delComprehensivePersonTaxIncome(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/income/export', {
        ...this.queryParams
      }, `income_${new Date().getTime()}.xlsx`)
    },
    handleSubmit(row){

    },
    handleAudit(row){

    },
  }
};
</script>
